[#11683] Install JUL-to-SLF4J bridge to route java.util.logging through Maven logging#12345
Open
gnodet wants to merge 2 commits into
Open
[#11683] Install JUL-to-SLF4J bridge to route java.util.logging through Maven logging#12345gnodet wants to merge 2 commits into
gnodet wants to merge 2 commits into
Conversation
… through Maven logging Adds the jul-to-slf4j bridge so that libraries using java.util.logging (JUL) have their log output routed through SLF4J and Maven's logging system, instead of writing directly to stderr. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR backports the JUL-to-SLF4J bridge to the maven-4.0.x line so that libraries emitting java.util.logging (JUL) output no longer bypass Maven’s SLF4J-based logging configuration.
Changes:
- Adds
org.slf4j:jul-to-slf4jto root dependency management. - Includes
jul-to-slf4jin the Maven distribution and CLI module dependencies. - Installs
SLF4JBridgeHandlerduring CLI logging activation to route JUL into SLF4J.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pom.xml |
Manages jul-to-slf4j version via ${slf4jVersion}. |
apache-maven/pom.xml |
Ensures the distribution pulls in the JUL bridge at runtime. |
impl/maven-cli/pom.xml |
Adds the CLI module dependency needed to compile/use SLF4JBridgeHandler. |
impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupInvoker.java |
Installs the JUL bridge during activateLogging(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+432
to
+434
| // Route java.util.logging (JUL) through SLF4J | ||
| SLF4JBridgeHandler.removeHandlersForRootLogger(); | ||
| SLF4JBridgeHandler.install(); |
Comment on lines
+432
to
+434
| // Route java.util.logging (JUL) through SLF4J | ||
| SLF4JBridgeHandler.removeHandlersForRootLogger(); | ||
| SLF4JBridgeHandler.install(); |
Avoid redundantly removing handlers and reinstalling the SLF4JBridgeHandler on every activateLogging() call, which matters in embedded/resident-mode scenarios where Maven is invoked multiple times in the same JVM. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of the JUL-to-SLF4J bridge fix to the
maven-4.0.xbranch.Libraries that use
java.util.logging(JUL) currently write their log output directly tostderr, bypassing Maven's logging configuration. This PR adds thejul-to-slf4jbridge so that JUL output is routed through SLF4J and Maven's logging system.Changes
jul-to-slf4jto dependency managementjul-to-slf4jas a runtime dependencyjul-to-slf4jdependencySLF4JBridgeHandlerat the start ofactivateLogging()to redirect JUL to SLF4JTest plan
🤖 Generated with Claude Code